package com.zhkj.txg.module.product.adapter

import android.app.Activity
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.txg.R
import com.zhkj.txg.module.product.ui.WatcherActivity
import com.zhkj.txg.utils.ImageUtils

class CommentPictureAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_share_pic) {

    init {
        setOnItemClickListener { _, _, position ->
            (context as? Activity)?.let { activity ->
                val list = arrayListOf<String>()
                data.forEach { list.add(it) }
                WatcherActivity.open(activity, list, position)
            }
        }
    }

    override fun convert(helper: BaseViewHolder, item: String) {
        val imageView = helper.getView<ImageView>(R.id.ivShare)
        ImageUtils.loadRoundCornerImage(context, imageView, item)
    }
}